<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.

require_once( dirname(__FILE__) . '/../helpers/common_helper.php');

return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'PC2Mobi',

	'sourceLanguage' => 'en',
	'language' => 'en',
	
	'theme' => 'bootstrap',

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
		'application.extensions.*',
		'application.helpers.*',
		'application.widgets.*',
		'application.vendors.*',
		'application.vendors.google.Utmz_cookie_parser',
		'application.modules.file.FileModule',
		'application.modules.file.models.*',
		'application.modules.notification.NotificationModule',
		'application.modules.notification.models.Notification',
		'application.modules.user.UserModule',
		'application.modules.user.models.User',
		'application.modules.user.components.UserIdentity'
	),
	'modules'=>array(
		'contact',
		'editor',
		'file',
		'notification',
		'user',
		'api',
		'gii' => array(
			'class'=>'system.gii.GiiModule',
			'password'=>'123456',
			'ipFilters' => array(
				'127.0.0.1',
				'::1'
			)
		),
	),
	
	'controllerMap' => array( 'photo_upload' => 'application.modules.editor.RedactorController', ),
	// application components
	'components'=>array(
		'session'=>array(
			'class'=>'system.web.CDbHttpSession',
			'connectionID'=>'db',
			'sessionTableName' => '{{sessions}}',
		),
		// uncomment the following to enable URLs in path-format
		'urlManager'=>array(
			'urlFormat'=>'path',
			'cacheID'=>false,
			'urlSuffix'=>'',
			'showScriptName' => false,
			'rules'=>array(
				'/' => 'site/index',
				'<action:download>/<user>/<filename>' => 'site/download/user/<user>/filename/<filename>',
				'<action:(!admin)>/*' => 'site/<action>',
				'<_c:(site)>/<_a>' => '<_c>/<_a>',
				'<_m>/<_a>' => '<_m>/default/<_a>',
				'<_m>/<_c>/<_a>' => '<_m>/<_c>/<_a>',

				'admin/<module:\w+>/<action:\w+>'=>'<module>/admin/<controller:(default)>/<action>', // CGridView ajax
				'admin/<module:\w+>/<controller:\w+>/<action:\w+>'=>'<module>/admin/<controller>/<action>', // CGridView ajax
			),
		),
		'mailer'=>array(
			'class'=>'ext.swiftMailer.SwiftMailer',

			'mailer'=>'smtp',
			
			'host' => 'smtp.mail.ru',
			'username' => 'smtp_server',
			'password' => 'LEXM.9^TAXqZN',
			
			'sendmailCommand'=>'/usr/sbin/sendmail -t -i',

		),
		/*'ftp'=>array(
			'class'=>'application.extensions.ftp.EFtpComponent',
			'host'=>'127.0.0.1',
			'port'=>21,
			'username'=>'yourusername',
			'password'=>'yourpassword',
			'ssl'=>false,
			'timeout'=>90,
			'autoConnect'=>true
		),*/
		'cache'=>array(
			'class'=>'system.caching.CFileCache',
		),
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
		),
		// uncomment the following to use a MySQL database
		'db'=>require(dirname(__FILE__) . '/db.php'),
		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'site/error',
		),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning, info',
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=> array(
		// this is used in contact page
		'systemEmail'=>'smtp_server@mail.ru',
		
		'defaultLang'=>'ru',
		'adminDefaultLang'=>'ru',
		
		'adminTheme'=>'admin',
		'adminPaginationPageSize'=>10,

		'registrationAdminApproveRequired'=>false,
		
		'cachePages'=>false,
		'cacheEnabled'=>true,

		'dateFormat'=>'d.m.Y H:i',
		
		
		'uploadTimeoutGuest'=>1,	// интервал отправки для гостя, сек
		'uploadTimeoutAuth'=>1,	// интервал отправки для авторизованного, сек
		'maxFileSize'=>2,			// макс размер файла, Mb
		'maxTextSize'=>1024,		// макс размер текста, b
		'uploadLifeTime'=>1,		// срок жизни загрузки, дни

	)
);